package jcFrame;

import java.awt.Dimension;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Point;

import javax.swing.JFrame;
import javax.swing.JPanel;

@SuppressWarnings("serial")
public class jcFrame extends JFrame{
	
	//#########################//
	
    JPanel 		content = new JPanel();
    titlePane 	title 	= new titlePane(this);
	public boolean isInFullScreen = false;
	GraphicsEnvironment localEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
	GraphicsDevice defaultDevice = localEnvironment.getDefaultScreenDevice();
	Dimension mySize = new Dimension(1000,600);
	Point myLocation = new Point();
	
  //#########################//
    
public jcFrame(){
	   
	    setUndecorated(true);
	    setVisible(true);
	    setLayout(new GridBagLayout());
	   
	    
	    
	    GridBagConstraints c = new GridBagConstraints();
	    c.anchor=GridBagConstraints.NORTH;
	    c.fill=GridBagConstraints.BOTH;
	    c.weightx=1;
	    c.weighty=0;
	    c.gridx=0;
	    c.gridy=0;
	    getContentPane().add(title,c);
	    c.weighty=1;
	    c.gridy=1;
	    getContentPane().add(content,c);
	    
	    setSize(mySize);
}

//#########################//

public void setTitle(String t){
	title.setTitle(t);
}

//#########################//

public void setFullscreen(){
	isInFullScreen=true;
	mySize=this.getSize();
	myLocation=this.getLocation();
	defaultDevice.setFullScreenWindow(this);
}

//#########################//

public JPanel getPane(){
	return content;
}

public void exitFullscreen() {
	isInFullScreen=false;
	defaultDevice.setFullScreenWindow(null);
	this.setLocation(myLocation);
	this.setSize(mySize);
	
}

//#########################//

}


	    
	    
	  
